<script type="text/javascript">
var play_index = 0;
var id_array = [ {volist name=":get_content_pages($id)" id="rs"} {$rs.id}, {/volist} ];

function player_start(){
	get_content();
}

// 打开哪一节
function change_play(index,obj){
	play_index = index;
	layer.msg("请稍候,内容加载中...");
	get_content();
	$(".more_list a").removeClass('choose');
	obj.addClass('choose');
}

function get_content(){
	setTimeout(function(){
		$.get("{:urls('wxapp.pages/get_content',['aid'=>$id])}?id="+id_array[play_index]+"&sid="+play_index,function(res){
			if(res.code==0){
				layer.closeAll();
				$("#artic_content").html(res.data.content);
				//查看大图
				$("#artic_content").viewer('destroy').viewer({
					navbar:true,
					title:false,
				});
			}else if(res.code==2){
				layer.confirm("需要支付 "+url_money[play_index]+" 元,才能查看,你还要继续吗?",{btn:['继续','放弃'],title:false,cancel:function(){}},function(){
					pay_money(url_money[play_index],play_index)
				},function(){});
			}else{
				layer.alert(res.msg);
			}
		});
	},url_money[play_index]?0:1000);
	
}

$(function(){
	play_url();
	{if empty(input('sid'))&&$info.price>0}
		change_play(0,$(".more_list .list").eq(0).find('a'));	//设置了统一收费的话，需要检查权限
	{/if}
})
</script>